package com.example.tests;

import org.testng.annotations.Test;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import com.example.fw.GroupObject;
import com.example.fw.Groups;

public class GroupModificationTests extends TestBase {

    @Test(dataProvider = "randomGroups", dataProviderClass = GroupDataGenerator.class)
	 public void modificatedGroupWithAllData(GroupObject newGroup) throws Exception {    	
		Groups oldGroups = app.getGroupHelper().getGroups();		
		GroupObject oldGroup = oldGroups.getSomeGroup();	
		app.getGroupHelper().modifyGroup(oldGroup, newGroup);
		Groups newGroups = app.getGroupHelper().getGroups();
		assertThat(newGroups, equalTo(oldGroups.without(oldGroup).withAdded(newGroup)));
	}
}
